Skip to content

Create and link against libllvmlibc-sparse#40

Merged
nickdesaulniers merged 5 commits into
mainfrom
llvmlibc
Jul 14, 2022
Merged

Create and link against libllvmlibc-sparse#40
nickdesaulniers merged 5 commits into
mainfrom
llvmlibc

Conversation

@nickdesaulniers

Copy link
Copy Markdown
Member

Using musl solved our static linking woes, but introduced performance
regressions. Specifically, calls to memset, memcpy, memcmp, and strlen
became more noticeable in profiles.

Build llvmlibc, extract the .o files from the .a for those 4, repack
them in a new .a, then link against that.

llvmlibc's strlen isn't measurably better, but the author is aware and
interested in fixing.

See
#39 (comment)
for performance measurements.

Fixes #39

Using musl solved our static linking woes, but introduced performance
regressions. Specifically, calls to memset, memcpy, memcmp, and strlen
became more noticeable in profiles.

Build llvmlibc, extract the .o files from the .a for those 4, repack
them in a new .a, then link against that.

llvmlibc's strlen isn't measurably better, but the author is aware and
interested in fixing.

Fixes #39

@compnerd compnerd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like tihi worthy.

-C llvm-project/stage3.cmake \
-D LLVM_DEFAULT_TARGET_TRIPLE=$(clang -print-target-triple) \
-S llvm-project/llvm \
-D CMAKE_EXE_LINKER_FLAGS="-static -lc++abi -ljemalloc -lllvmlibc-sparse -Wl,--allow-multiple-definition" \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to prefer -Xlinker --allow-multiple-definition. However, this is gross either way.

@nathanchance nathanchance left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some minor nits.

Comment thread llvm-project/Dockerfile.epoch3 Outdated
Comment thread llvm-project/build_sparse_libc.sh Outdated
Comment thread llvm-project/stage3.cmake Outdated
@nickdesaulniers nickdesaulniers merged commit 4f61d5f into main Jul 14, 2022
@nickdesaulniers nickdesaulniers deleted the llvmlibc branch July 14, 2022 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build llvm libc

3 participants